<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/commons/taglibs.jsp" %>
<%@ include file="/commons/script.jsp" %>
<script type="text/javascript" src="${ctx }/assets/js/pinyin_dict_notone.js"></script>
<script type="text/javascript" src="${ctx }/assets/js/pinyinUtil.js"></script>
<body>
<script>
jQuery(function($) {
	formvalidation("#addForm",{		
		dictCode:{
			remote:{
				url:"${ctx}/sysDict/json/checkCode",
				data:{
					id:$("#id").val(),
					parentId:$("#parentId").val()
				}
			}
		}
	},{
		dictCode:{
			remote:"<fmt:message key='SysDict.error.codeExist'/>"
		}
	})
	$("#saveBtn").click(function(){
		$("#addForm").submit();
	})
	
	$("#menuName").blur(function(){	
			$("#menuCode").val(pinyinUtil.getPinyin($("#menuName").val()).replace(/\s+/g, ""));
	})
	
	
})
</script>
<custom:message></custom:message>
	<fmt:message key="label.pleaseInput" var="pleaseInput"></fmt:message>
	<fmt:message key="SysDict.dictName.title" var="dictNameTitle"></fmt:message>
	<fmt:message key="SysDict.dictCode.title" var="dictCodeTitle"></fmt:message>
	<fmt:message key="SysDict.dictDesc.title" var="dictDescTitle"></fmt:message>
	<form:form action="${ctx }/sysDict/popup/save" id="addForm" name="addForm" modelAttribute="sysDict" method="post">
		<form:hidden path="id"/>
		<form:hidden path="parent.id"/>		
		<div class="form-group">
					<label class="control-label col-md-3"> <span class="required">*</span> 
					${dictNameTitle }:
					</label>
				<div class="col-md-6">
					<form:input path="dictName" cssClass="form-control"  placeHolder='${pleaseInput } ${dictNameTitle }' required="true"/>
				</div>
		</div>
		<div class="form-group">
			
				<label class="control-label col-md-3"> <span class="required">*</span> 
				${dictCodeTitle }:
				</label>					
				<div class="col-md-6">
					<form:input path="dictCode" cssClass="form-control required" maxlength="45"  placeHolder="${pleaseInput } ${dictCodeTitle }"/>
				</div>
			
		</div>
		<div class="form-group">
				<label class="control-label col-md-3"> 
				${dictDescTitle }:
				</label>
				<div class="col-md-6">
					<form:input path="dictDesc" cssClass="form-control" maxlength="250" placeHolder="${pleaseInput } ${dictDescTitle }"/>
				</div>
		</div>
		
		<div class="form-group">	
				<div class="col-md-6">
					<a id="saveBtn" class="btn btn-primary"><fmt:message key="navigation.button.save"/></a>
					<a id="cancelBtn" class="btn btn-danger"  onclick="top.Dialog.close()"><fmt:message key="navigation.button.cancel"/></a>
					
				</div>
		</div>
		<div id="afterupdate"></div>
	</form:form>
</body>
